package com.hsy.managemoney.modules.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import com.ant.liao.GifAction;
import com.ant.liao.GifDecoder;
import com.ant.liao.GifFrame;
import com.ant.liao.GifView;
import com.hsy.managemoney.R;


/**
 * Created by MartinKent on 2016/7/15.
 */
public class LoadingDialog extends Dialog {
    private View contentView;

    public LoadingDialog(Context context) {
        super(context, R.style.loading_dialog_style);
        init(context);
    }

    public LoadingDialog(Context context, int themeResId) {
        super(context, R.style.loading_dialog_style);
        init(context);
    }

    protected LoadingDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, R.style.loading_dialog_style);
        init(context);
    }

    private void init(Context context) {
        contentView = LayoutInflater.from(context).inflate(R.layout.gif, null);
        setContentView(contentView);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView(contentView);
    }

    private GifView gif;

    private void initView(View rootView) {
        gif = (GifView) rootView.findViewById(R.id.gif);
        gif.setGifImageType(GifView.GifImageType.COVER);
        gif.setGifImage(R.drawable.loading);
    }

    @Override
    public void dismiss() {
        super.dismiss();
    }
}
